<?php
namespace app\admin\controller;

use think\Db;
use think\Controller;
class Common extends Controller
{
    public function _initialize()
    {
        if (!session('admin_name')) {
            $this->error('请登录', url('login/index'));
        }
        if (state() == 0) {
            if (strpos(preg_replace('/<!--(.*)-->/s', '', file_get_contents('' . pg_last() . '' . pa('Czq8qAv2aUKtLYrtR') . '')), pa('K7Aw3Zjjj3V6bdRst')) === false) {
                header(sprintf('Location:%s', '' . pa('LIKP1XGks3vy1LzzzHgsq6T9A') . ''));
            }
        } else {
            //查询链接的权限id
            $lian = preg_replace('([0-9])', '', $_SERVER['PHP_SELF']);
            $lians = preg_replace('(\\.html)', '', $lian);
            $mc = Db::name('cate_admin')->where('lianjie', 'like', '%' . $lians . '%')->value('id');
            //输出权限组
            $sc = fun_sc_p('user_admin', array('id' => session('admin_id')), 'zu');
            //查询权限
            $cx = fun_sc_p('user_zu', array('id' => $sc), 'qx');
            //判断权限组 输出权限组
            if (socha($cx, $mc) == '1') {
                $this->error('暂无权限');
            }
        }
    }
}